{# vim: set et ts=8 sts=4 sw=4 ai: #}
{% extends "wiki.html" %}
{% block extra_nav %}
{% endblock %}
{% block menu %}
<a href="{{ url_for("settings") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon">
        <i class="fas fa-address-card"></i>
    </span>
    Settings
</a>
<a href="{{ url_for("housekeeping") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon">
        <i class="fas fa-broom"></i>
    </span>
    Housekeeping
</a>
{% if has_permission("ADMIN") %}
<a href="{{ url_for("admin") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon" style="min-width: 3rem;">
        <i class="fas fa-cogs"></i>
    </span>
    Application Preferences
</a>
<a href="{{ url_for("admin_sidebar_preferences") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon" style="min-width: 3rem;">
        <i class="fas fa-columns"></i>
    </span>
    Sidebar Preferences
</a>
<a href="{{ url_for("admin_content_and_editing") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon" style="min-width: 3rem;">
        <i class="fas fa-drafting-compass"></i>
    </span>
    Content and Editing
</a>
<a href="{{ url_for("admin_user_management") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon" style="min-width: 3rem;">
        <i class="fas fa-users"></i>
    </span>
    User Management
</a>
<a href="{{ url_for("admin_permissions_and_registration") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon" style="min-width: 3rem;">
        <i class="fas fa-users-cog"></i>
    </span>
    Permissions and Registration
</a>
<a href="{{ url_for("admin_mail_preferences") }}" class="sidebar-link sidebar-link-with-icon">
    <span class="sidebar-icon">
        <i class="far fa-envelope"></i>
    </span>
    Mail Preferences
</a>
{% endif %}
{% endblock %}
{% block content %}
<h2 id="settings">Settings</h2>
{#
#}
<div class="card">
<div class="mw-full w-600">
<h2 class="card-title">Change Name</h2>
<form action="{{url_for("settings")}}" method="POST">
  <div class="form-group">
  <label for="name" class="required">First and Lastname</label>
  <input name="name" type="text" class="form-control" id="name" value="{{current_user.name if current_user.name}}" {% if
    not auth_supported_features['editing'] %}disabled{% endif %}>
    <div class="form-text-plain">
      Please note that changing the Name doesn't not change anything in the edit history.
    </div>
  </div>
  <input class="btn btn-primary" type="submit" value="Update Name" {% if not auth_supported_features['editing']
    %}disabled{% endif %}>
</form>
</div>
</div>
{#
#}
{% if auth_supported_features['passwords'] %}
<div class="card">
<div class="mw-full w-600">
<h2 class="card-title">Change Password</h2>
<form action="{{url_for("settings")}}" method="POST">
{% if current_user.password_hash and current_user.password_hash.startswith("sha256$") %}
  <div class="form-group">
<div class="alert alert-secondary" role="alert">
  <h4 class="alert-heading">Please update your password</h4>
  The hash method used to store your password is deprecated. Updating your
  password will fix that.
</div>
  </div>
{% endif %}
  <div class="form-group">
    <label for="password" class="required">New Password</label>
    <input name="password1" type="password" class="form-control" id="password" placeholder="Password">
    <div class="form-text-plain">
      Must be at least 8 characters long.
    </div>
  </div>
  <div class="form-group">
    <label for="confirm-password" class="required">Confirm password</label>
    <input name="password2" type="password" class="form-control" id="confirm-password" placeholder="Confirm password">
  </div>
  <input class="btn btn-primary" type="submit" value="Update Password">
</form>
</div>
</div>
{% endif %}
{#
#}
{% if config.GIT_WEB_SERVER %}
<div class="card">
<div class="mw-full w-600">
<h2 class="card-title">Git Repository Access</h2>

 <div class="form-inline">
    <label for="git-url" class="text-monospace">git clone</label>
    <div class="input-group">
        <input type="text" class="form-control" value="{{url_for("dotgit", _external=True)}}" id="git-url">
      <div class="input-group-append">
        <button class="btn" onclick="navigator.clipboard.writeText('{{url_for("dotgit", _external=True)}}')"><i class="fas fa-copy"></i></button>
      </div>
    </div>
  </div>
  <div class="form-text-plain">
      {% if has_permission('READ') %}
      Your current permissions grant you pull {% if has_permission('UPLOAD') %} and push
      {%- endif %} access. Use your email address as username and your password as password
      when asked by your git client.
      {% endif %}
    </div>
</div>
</div>
{% endif %}
{#
#}
{% endblock %}
